1 BayesianAPP Overview

BayesianAPP is a package for automatically download KEGG pathway data (kgml file) and

2 Citation

The BayesianAPP package utilize Pathway prioritization approach from the following publication. Please try to cite the article when your publication result obtained by using this software.

Add citation

3 Installation

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("BayesianAPP")

4 Example Data

Example data were simulated from GSE20685. Simulation details include indiviudal random sampling and expression level shifting and scaling for each gene.

library(BayesianAPP)

data("BayesianAPP.example")
attach(BayesianAPP.example)

Simulated gene expression data contains header. The first column is ENTREZ gene ID, the second column is corresponding gene symbol and the other fields are gene expression value for each individual.

head(GE_data[,seq(5)])
##   ENTREZ_GENE_ID Gene.Symbol  case_1  case_2  case_3
## 1              1        A1BG  8.8239  8.6329  7.6936
## 2              2         A2M 12.4704 12.7797 12.5137
## 3              3       A2MP1  6.6183  4.7546  4.2940
## 4              9        NAT1 15.1912 11.5157 14.2173
## 5             10        NAT2  3.1079  4.3559  2.9828
## 6             12    SERPINA3 13.7560  9.9250  9.7697

Simulated phenotype data contains 50 cases and 50 controls with header. The first column is sample ID and the second is status/phenotype.

head(pheno_data)
##       ID Status
## 1 case_1      1
## 2 case_2      1
## 3 case_3      1
## 4 case_4      1
## 5 case_5      1
## 6 case_6      1
tail(pheno_data)
##             ID Status
## 95  control_45      0
## 96  control_46      0
## 97  control_47      0
## 98  control_48      0
## 99  control_49      0
## 100 control_50      0
table(pheno_data$Status)
## 
##  0  1 
## 50 50

5 Quick Start

library(BayesianAPP)

data("BayesianAPP.example")
attach(BayesianAPP.example)

5.1 Download KGML and make GMX file

download_kgml(pathwayid = c("04115", "04915", "04630"),
              species = "hsa",
              dir = getwd(),
              download_subpathway = TRUE,
              gmx = TRUE)

5.2 Visualize pathway and variance of gene expression level

p <- plotly_refgene(file = GE_data,
                    pathwayid = "04115",
                    species = "hsa")
## D:/BayesianAPP/BayesianAPP/plotly_hsa04115/hsa04115_pathway.html is made.
## D:/BayesianAPP/BayesianAPP/plotly_hsa04115/hsa04115_barplot.html is made.
## D:/BayesianAPP/BayesianAPP/plotly_hsa04115/hsa04115_combined.html is made.
# A list of plotly output
p[[1]]

     

# It is also allowed to input multiple pathways.
plotly_refgene(file = GE_data,
               pathwayid = c("04115", "04915", "04630"),
               species = "hsa")

5.3 Pathway Prioritization via BayesianAPP

# Perform BayesianAPP analysis
# file_gmx is the file generated by download_kgml() 

# Please run R/RStudio as administrator or it may not work out.

output <- BayesianAPP(dir        = getwd(),
                      file_ge    = GE_data,
                      file_pheno = pheno_data,
                      file_gmx   = c("hsa04115_entrezid.gmx",
                                     "hsa04915_entrezid.gmx",
                                     "hsa04630_entrezid.gmx"),
                      ref_gene   = c("7157","1956","116379"),
                      out_type   = "D",
                      model_file = "my_model.odc",
                      n.iter     = 6000,
                      n.chains   = 1,
                      n.burnin   = 1000,
                      n.thin     = 10)

# Display rank of competeting pathways
output$rank.table
##                 Pathway Rank Posterior.prob
## 1 hsa04630_entrezid.gmx    1         1.0000
## 2 hsa04915_entrezid.gmx    2         0.9966
## 3 hsa04115_entrezid.gmx    3         0.7604
# visualization of density of beta coefficients for each pathway
plot.BayesianAPP(output)

6 Session Information

This analysis was conducted on:

sessionInfo()
## R version 3.6.2 (2019-12-12)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 18362)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=Chinese (Traditional)_Taiwan.950 
## [2] LC_CTYPE=Chinese (Traditional)_Taiwan.950   
## [3] LC_MONETARY=Chinese (Traditional)_Taiwan.950
## [4] LC_NUMERIC=C                                
## [5] LC_TIME=Chinese (Traditional)_Taiwan.950    
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] BayesianAPP_0.1.0    R2OpenBUGS_3.2-3.2   purrr_0.3.3         
##  [4] plotly_4.9.1         ggplot2_3.2.1        pathview_1.26.0     
##  [7] org.Hs.eg.db_3.10.0  AnnotationDbi_1.48.0 IRanges_2.20.2      
## [10] S4Vectors_0.24.3     Biobase_2.46.0       BiocGenerics_0.32.0 
## [13] matrixStats_0.55.0   data.table_1.12.8    knitr_1.28          
## [16] BiocStyle_2.14.4    
## 
## loaded via a namespace (and not attached):
##   [1] fastmatch_1.1-0        BiocFileCache_1.10.2   plyr_1.8.5            
##   [4] igraph_1.2.4.2         lazyeval_0.2.2         splines_3.6.2         
##   [7] BiocParallel_1.20.1    crosstalk_1.0.0        sva_3.34.0            
##  [10] urltools_1.7.3         digest_0.6.23          htmltools_0.4.0       
##  [13] GOSemSim_2.12.0        viridis_0.5.1          GO.db_3.10.0          
##  [16] magrittr_1.5           memoise_1.1.0          limma_3.42.2          
##  [19] Biostrings_2.54.0      annotate_1.64.0        graphlayouts_0.5.0    
##  [22] askpass_1.1            enrichplot_1.6.1       prettyunits_1.1.1     
##  [25] colorspace_1.4-1       blob_1.2.1             rappdirs_0.3.1        
##  [28] ggrepel_0.8.1          xfun_0.12              dplyr_0.8.4           
##  [31] crayon_1.3.4           RCurl_1.98-1.1         jsonlite_1.6.1        
##  [34] graph_1.64.0           genefilter_1.68.0      survival_3.1-8        
##  [37] glue_1.3.1             polyclip_1.10-0        gtable_0.3.0          
##  [40] zlibbioc_1.32.0        XVector_0.26.0         Rgraphviz_2.30.0      
##  [43] scales_1.1.0           DOSE_3.12.0            pheatmap_1.0.12       
##  [46] DBI_1.1.0              Rcpp_1.0.3             viridisLite_0.3.0     
##  [49] xtable_1.8-4           progress_1.2.2         gridGraphics_0.4-1    
##  [52] bit_1.1-15.2           europepmc_0.3          htmlwidgets_1.5.1     
##  [55] httr_1.4.1             fgsea_1.12.0           RColorBrewer_1.1-2    
##  [58] pkgconfig_2.0.3        XML_3.99-0.3           farver_2.0.3          
##  [61] dbplyr_1.4.2           labeling_0.3           later_1.0.0           
##  [64] ggplotify_0.0.4        tidyselect_1.0.0       rlang_0.4.4           
##  [67] reshape2_1.4.3         munsell_0.5.0          tools_3.6.2           
##  [70] RSQLite_2.2.0          ggridges_0.5.2         fastmap_1.0.1         
##  [73] evaluate_0.14          stringr_1.4.0          yaml_2.2.1            
##  [76] bit64_0.9-7            tidygraph_1.1.2        KEGGREST_1.26.1       
##  [79] dendextend_1.13.3      ggraph_2.0.1           nlme_3.1-144          
##  [82] mime_0.9               KEGGgraph_1.46.0       DO.db_2.9             
##  [85] xml2_1.2.2             biomaRt_2.42.0         MAGeCKFlute_1.6.3     
##  [88] compiler_3.6.2         curl_4.3               png_0.1-7             
##  [91] ggsignif_0.6.0         tibble_2.1.3           tweenr_1.0.1          
##  [94] stringi_1.4.4          lattice_0.20-38        Matrix_1.2-18         
##  [97] ggsci_2.9              vctrs_0.2.2            pillar_1.4.3          
## [100] lifecycle_0.1.0        BiocManager_1.30.10    triebeard_0.3.0       
## [103] cowplot_1.0.0          bitops_1.0-6           httpuv_1.5.2          
## [106] qvalue_2.18.0          R6_2.4.1               promises_1.1.0        
## [109] bookdown_0.17          gridExtra_2.3          boot_1.3-24           
## [112] MASS_7.3-51.5          assertthat_0.2.1       openssl_1.4.1         
## [115] withr_2.1.2            mgcv_1.8-31            hms_0.5.3             
## [118] clusterProfiler_3.14.3 grid_3.6.2             tidyr_1.0.2           
## [121] coda_0.19-3            rmarkdown_2.1          rvcheck_0.1.7         
## [124] ggpubr_0.2.4           ggforce_0.3.1          shiny_1.4.0           
## [127] base64enc_0.1-3

7 References

Lin, S. J., Lu, T. P., Yu, Q. Y., Hsiao, C. K. (2018). Probabilistic prioritization of candidate pathway association with pathway score. BMC bioinformatics, 19(1), 391. https://doi.org/10.1186/s12859-018-2411-z